#@weiXinLayout("订单确认")

#define weiXinMain()
<div id="order-#(order.id??'')">

    <div class="weui-panel__hd order-title">
        <div style="font-weight: bolder;color: black;font-size: 16px;">订单号:#(order.order_ser??'')</div>
    </div>
    <div class="weui-panel__bd">
        #for(x:order.items)
        <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
            <div class="weui-media-box__hd">
                <img class="weui-media-box__thumb" src="#(x.cover??'')">
            </div>
            <div class="weui-media-box__bd">
                <h4 class="weui-media-box__title">#(x.name??'')</h4>
                <p class="weui-media-box__desc">#(x.desc??'')</p>
                <p class="price">￥#(x.price??'') 购买数量:#(x.num)<span class="status">#(x.is_post??'')</span></p>
            </div>
        </a>
        #end
    </div>

    <div class="weui-panel__hd order-title">
        <div style="font-weight: bolder;color: black;font-size: 16px;">订单送货地址</div>
    </div>
    <div class="weui-panel__bd">
        <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
            <div class="weui-media-box__bd">
                <h4 class="weui-media-box__title">#(order.address??'')</h4>
                <p class="weui-media-box__desc">#(order.name??'') #(order.mobile??'')</p>
            </div>
        </a>
    </div>

    <div class="weui-panel__hd order-title">
        <div style="font-weight: bolder;color: black;font-size: 16px;">配送方式</div>
    </div>
    <div class="weui-panel__bd" style="margin-bottom: 50px;">
        <a href="javascript:void(0);" class="weui-media-box weui-media-box_appmsg">
            <div class="weui-media-box__bd">
                <h4 class="weui-media-box__title">顺丰快递</h4>
                <p class="price">快递费用:￥#(order.deliveryFee()??'')</p>
            </div>
        </a>
    </div>

    <div class="weui-tab">
        <div class="weui-tabbar tab-bar-fixbottom" style="display: flex;justify-content: space-between">
            <div class="tel">
                总价：￥#(order.totalFeeWithDelivery())
            </div>
            <div class="orderBtnContainer" id="submitBtn">立即支付</div>
        </div>
    </div>
</div>
#end

#define weiXinCss()
<style>
    .price{
        font-weight: bolder;
        font-size:18px ;
        color: #e2541f;
    }
    .tel{
        font-weight: bolder;
        font-size:18px ;
        display: flex;
        justify-content: center;
        align-items: center;
        color: #e2541f;
    }
    .orderBtnContainer{
        padding: 10px;
        background-color: #e2541f;
        color: white;
        width: 100px;
        text-align: center;
    }
</style>
#end

#define weiXinJs()
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
    $(document).ready(function() {
        /**
         * 支付相关
         */
        wx.config({
            debug: false,
            appId: '#(appId)',
            timestamp: '#(timestamp)',
            nonceStr: '#(nonceStr)',
            signature: '#(signature)',
            jsApiList: [  //需要使用的网页服务接口
                'checkJsApi',  //判断当前客户端版本是否支持指定JS接口
                //'onMenuShareTimeline', //分享给好友
                //'onMenuShareAppMessage', //分享到朋友圈
                //'onMenuShareQQ',  //分享到QQ
                //'onMenuShareWeibo', //分享到微博
                //'startRecord', 'stopRecord', 'playVoice', "uploadVoice",
                'chooseWXPay'
            ]
        });

        $('#submitBtn').on("click", function () {
            var config = {
                "url": "#(contextPath)/weixin/pay/doProductPay",
                "method": "POST",
                "data": {"id":"#(order.id??'')"},
                "successCallBack": function (resp) {
                    if (resp.result) {
                        WeixinJSBridge.invoke(
                            'getBrandWCPayRequest', {
                                "appId": resp.data.appId,     //公众号名称，由商户传入
                                "timeStamp": resp.data.timeStamp,         //时间戳，自1970年以来的秒数
                                "nonceStr": resp.data.nonceStr, //随机串
                                "package": resp.data.package,
                                "signType": "MD5",         //微信签名方式：
                                "paySign": resp.data.paySign //微信签名
                            },
                            function (res) {
                                if (res.err_msg == "get_brand_wcpay_request:ok") {
                                    window.location.href="#(contextPath)/weixin/order/payOrderSuccess?id=0"
                                }
                            }
                        );
                    } else {
                        $.alert(resp.msg);
                    }
                }
            };
            var ajax = new AjaxUtils(config);
            ajax.executeRequest();
        });
    });

</script>
#end